package com.test.web.service;

import cn.hutool.core.util.IdUtil;
import com.test.web.dao.VersionDao;
import com.test.web.entity.Version;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author heyanjing
 * date:2020-06-09 2020/6/9:22:54
 */
@Slf4j
@Service
public class VersionService {

    @Resource
    private VersionDao versionDao;


    public int deleteByPrimaryKey(String versionId) {
        return versionDao.deleteByPrimaryKey(versionId);
    }


    public int insert(Version record) {
        int i = 1 / 0;
        record.setVersionId(IdUtil.simpleUUID());
        return versionDao.insert(record);
    }


    public int insertOrUpdate(Version record) {
        return versionDao.insertOrUpdate(record);
    }


    public int insertOrUpdateSelective(Version record) {
        return versionDao.insertOrUpdateSelective(record);
    }


    public int insertSelective(Version record) {
        return versionDao.insertSelective(record);
    }


    public Version selectByPrimaryKey(String versionId) {
        //不能要try catch  不然统一异常处理里面打印的出错位置会是 catch里面的 throw new RuntimeException
        // try {
        int i = 1 / 0;
        return versionDao.selectByPrimaryKey(versionId);
        // } catch (Exception e) {

        // String o = Webs.errorDetail(e,);
        // log.info("{}", o);
        // throw new RuntimeException(e);
        // }
    }


    public int updateByPrimaryKeySelective(Version record) {
        return versionDao.updateByPrimaryKeySelective(record);
    }


    public int updateByPrimaryKey(Version record) {
        return versionDao.updateByPrimaryKey(record);
    }


    public int updateBatch(List<Version> list) {
        return versionDao.updateBatch(list);
    }


    public int batchInsert(List<Version> list) {
        return versionDao.batchInsert(list);
    }

}
